from typing import List


class Solution:
    def differByOne(self, dict: List[str]) -> bool:
        hashset = set(dict)

        for word in dict:
            for i in range(len(word)):
                a1 = ord(word[i]) - 97
                for a2 in range(26):
                    if a1 != a2:
                        if word[:i] + chr(a2 + 97) + word[i + 1:] in hashset:
                            return True
        return False


if __name__ == "__main__":
    print(Solution().differByOne(dict=["abcd", "acbd", "aacd"]))  # True
    print(Solution().differByOne(dict=["ab", "cd", "yz"]))  # False
    print(Solution().differByOne(dict=["abcd", "cccc", "abyd", "abab"]))  # True
